"use strict";
cc._RF.push(module, 'da59d7PdgJDyZxQUY7YlHED', 'HallAssemblyView');
// scripts/HallAssemblyView.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("AssemblyAttributeView"),
    s = t("CarConstant"),
    l = t("HallConstant"),
    c = t("GlobalUserData"),
    d = t("HallCarTotalView"),
    h = t("AttributeTotalView"),
    p = t("AssemblyEquipHint"),
    u = t("AssemblyItem"),
    f = t("HallSellView"),
    m = t("Hint"),
    _ = t("Util"),
    y = t("ScrollViewOptimize"),
    g = t("Global"),
    v = t("Common"),
    C = cc._decorator,
    b = C.ccclass,
    w = C.property,
    S = function (t) {
  function e() {
    var e,
        o = null !== t && t.apply(this, arguments) || this;
    return o.hallControl = null, o.attributeView = null, o.attributeTotalView = null, o.pfb_sell = null, o.scroll_Items = null, o.scrollContent_Items = null, o.pfb_assemblyItem = null, o.pfb_equipHint = null, o.frame_attribute = null, o.frame_attributeNum = null, o.frame_scrollview = null, o.frame_btnCarType = null, o.frame_btnBack = null, o.icon_btnBody = null, o.icon_btnWheel = null, o.icon_btnWeapon = null, o.icon_btnTools = null, o.scrollViewOptimize = null, o._sellView = null, o._nCarIndex = 0, o.isTouchEnable = !1, o._equipHint = null, o.curShowType = null, o.arrAssemblyItems = [], o.arrAssemblyData = [], o.tempVideoItem = null, o.posScrollContent = null, o._curTouchItem = null, o.touchItemIndex = 0, o.touchItem = null, o.itemEnterUid = 0, o.itemExitUid = 0, o.itemColliderTag = 0, o.itemEquipIndex = 0, o.strTouchState = "", o.posFrame_Attibute = cc.v3(-443, -50, 0), o.posFrame_AttibuteNum = cc.v3(0, -260, 0), o.posframe_btnCarType = cc.v3(525.5, -18, 0), o.posFrame_ScrollView = cc.v3(0, 246, 0), o.onGuideAction = (e = 0, function () {
      if (1 === c["default"].nTotalGame) switch (e) {
        case 0:
          e++, this.getItemNode("body02") ? this.hallControl.guide_move(this.getItemNode("body02"), c["default"].hallCarView.node.parent.getChildByName("btn_assemble"), -1, c["default"].hallCarView.node.parent.getChildByName("btn_assemble")) : this.onGuideAction();
          break;

        case 1:
          e++, this.getItemNode(s.Weapon_ID.Rocket) ? this.hallControl.guide_move(this.getItemNode(s.Weapon_ID.Rocket), c["default"].hallCarView.node.parent.getChildByName("btn_assemble"), -1, c["default"].hallCarView.equipCarBody.getWeapon_Node()) : this.onGuideAction();
          break;

        case 2:
        case 3:
          e++, this.getItemNode("wheel01") ? this.hallControl.guide_move(this.getItemNode("wheel01"), c["default"].hallCarView.node.parent.getChildByName("btn_assemble"), -1, c["default"].hallCarView.equipCarBody.getWheel_Node()) : this.onGuideAction();
          break;

        case 4:
          e++, this.hallControl.guide_click(this.frame_btnBack, -1);
          break;

        default:
          c["default"].saveGuideStepData(l.Guide_Step.Fight2), this.hallControl.hideGuide();
      }
      if (2 === c["default"].nTotalGame) switch (e) {
        case 0:
          e++, c["default"].saveGuideStepData(l.Guide_Step.Assembletheharpoon), this.onGuideAction();
          break;

        case 1:
          e++, c["default"].saveGuideStepData(l.Guide_Step.Assemblethehammer), this.getItemNode(s.Tools_ID.Harpoon) ? this.hallControl.guide_move(this.getItemNode(s.Tools_ID.Harpoon), c["default"].hallCarView.node.parent.getChildByName("btn_assemble"), 0, c["default"].hallCarView.equipCarBody.getTools_Node()) : this.onGuideAction();
          break;

        case 2:
          e++, this.getItemNode(s.Weapon_ID.Saw) ? this.hallControl.guide_move(this.getItemNode(s.Weapon_ID.Saw), c["default"].hallCarView.node.parent.getChildByName("btn_assemble"), 0, c["default"].hallCarView.equipCarBody.getWeapon_Node()) : this.onGuideAction();
          break;

        case 3:
          e++, this.hallControl.guide_click(this.frame_btnBack, -1);
          break;

        default:
          c["default"].saveGuideStepData(l.Guide_Step.Fight3), this.hallControl.hideGuide();
      }
    }), o.node_weapon = null, o.node_upgrade = null, o.isGuide = !1, o.guideIndex = 0, o;
  }

  return n(e, t), e.prototype.onLoad = function () {
    _.Util.event_dispatcher.register(this);
  }, e.prototype.onDestroy = function () {
    _.Util.event_dispatcher.remove(this);
  }, e.prototype.initData = function (t) {
    this.hallControl = t;
  }, e.prototype.start = function () {
    this.initView(), this.updateAttributeTotal(), cc.director.on(g.arrow_message, this.onEventPowerContrast, this);
  }, e.prototype.onEnable = function () {
    _.Util.hideBanner(), _.Util.hideHallBanner(), _.Util.hideNativeBanner(), _.Util.hideNativeGridAd(), _.Util.showSingleCustomAd(cc.v2(150, -60)), this.initScrolView();
  }, e.prototype.onDisable = function () {
    _.Util.hideSingleCustomAd();
  }, e.prototype.initView = function () {
    this.attributeView.init(this.hallControl);
  }, e.prototype.initScrolView = function () {
    for (var t = this.getAssemblyData(null, !0), e = t.length, o = 0, i = 0; i < e; ++i) {
      if (this.arrAssemblyItems[i]) this.arrAssemblyItems[i].getComponent(u.AssemblyItem).updateItem(this, !0, i, t[i], !0, u.Assembly_Type.Assembly), this.arrAssemblyItems[i].node.setSiblingIndex(i);else {
        var n = cc.instantiate(this.pfb_assemblyItem);
        this.scrollContent_Items.addChild(n), n.getComponent(u.AssemblyItem).updateItem(this, !0, i, t[i], !0, u.Assembly_Type.Assembly), this.arrAssemblyItems.push(n.getComponent(u.AssemblyItem));
      }
      o++;
    }

    for (i = o; i < this.arrAssemblyItems.length; i++) {
      this.arrAssemblyItems[o].onActive(!1);
    }

    c["default"].nGuideStep == l.Guide_Step.Assembletheharpoon && (console.log("迁移"), this.getaAssemblyItem(this.arrAssemblyItems, s.Tools_ID.Harpoon) && this.unshiftItem(this.getaAssemblyItem(this.arrAssemblyItems, s.Tools_ID.Harpoon)), this.getaAssemblyItem(this.arrAssemblyItems, s.Weapon_ID.Saw) && this.unshiftItem(this.getaAssemblyItem(this.arrAssemblyItems, s.Weapon_ID.Saw))), this.scrollViewOptimize.drawCall();
  }, e.prototype.unshiftItem = function (t) {
    t.setSiblingIndex(0);
  }, e.prototype.getaAssemblyItem = function (t, e) {
    for (var o = 0; o < t.length; o++) {
      var i = t[o];
      if (e == i.itemData.id && 1 == i.itemData.star) return i.node;
    }
  }, e.prototype.updateScrolView = function (t) {
    var e = this.getAssemblyData(t);

    if (this.curShowType != t && (this.curShowType = t || null), cc.log("长度updateScrolView：" + e.length), cc.log("长度updateScrolView：" + this.arrAssemblyItems.length), e.length > this.arrAssemblyItems.length) {
      for (var o = 0; o < e.length; ++o) {
        if (this.arrAssemblyItems[o]) this.arrAssemblyItems[o].updateItem(this, !0, o, e[o], !0, u.Assembly_Type.Assembly);else {
          var i = cc.instantiate(this.pfb_assemblyItem);
          this.scrollContent_Items.addChild(i), i.getComponent(u.AssemblyItem).updateItem(this, !0, o, e[o], !0, u.Assembly_Type.Assembly), this.arrAssemblyItems.push(i.getComponent(u.AssemblyItem));
        }
      }
    } else for (o = 0; o < this.arrAssemblyItems.length; ++o) {
      e[o] ? this.arrAssemblyItems[o].updateItem(this, !0, o, e[o], !0, u.Assembly_Type.Assembly) : this.arrAssemblyItems[o].onActive(!1);
    }

    this.scrollViewOptimize.drawCall();
  }, e.prototype.onEventPowerContrast = function (t) {
    for (var e = 0; e < this.arrAssemblyItems.length; e++) {
      this.arrAssemblyItems[e].onEventArrow(t);
    }
  }, e.prototype.getAssemblyData = function (t, e) {
    return void 0 === e && (e = !1), t ? this.getOneAssemblyData(t) : this.getAllAssemblyData(e);
  }, e.prototype.getOneAssemblyData = function (t) {
    var e = [];

    switch (t) {
      case s.Basics_Items_Type.body:
        for (var o = 0; o < c["default"].arrOwnBody.length; o++) {
          this.isOwnUidEquipBody(c["default"].arrOwnBody[o].uid) || e.push(c["default"].arrOwnBody[o]);
        }

        break;

      case s.Basics_Items_Type.wheel:
        for (o = 0; o < c["default"].arrOwnWheel.length; o++) {
          this.isOwnUidEquipWheel(c["default"].arrOwnWheel[o].uid) || e.push(c["default"].arrOwnWheel[o]);
        }

        break;

      case s.Basics_Items_Type.weapon:
        for (o = 0; o < c["default"].arrOwnWeapon.length; o++) {
          this.isOwnUidEquipWeapon(c["default"].arrOwnWeapon[o].uid) || e.push(c["default"].arrOwnWeapon[o]);
        }

        break;

      case s.Basics_Items_Type.tools:
        for (o = 0; o < c["default"].arrOwnTools.length; o++) {
          this.isOwnUidEquipUseTools(c["default"].arrOwnTools[o].uid) || e.push(c["default"].arrOwnTools[o]);
        }

    }

    return e = this.sortItemData(!1, e, t), this.arrAssemblyData = e, e;
  }, e.prototype.getAllAssemblyData = function (t) {
    void 0 === t && (t = !1), this.tempVideoItem && null != this.tempVideoItem.video && this.tempVideoItem.video && _.Util.saveTempOwnCarData(!1, this.tempVideoItem, this.tempVideoItem.type);
    var e = [];

    if (t && Math.random() < c["default"].videoItemProbability && !this.tempVideoItem && !c["default"].bAuditMode && c["default"].nGuideStep >= l.Guide_Step.Finish) {
      var o = Math.random() <= .5 ? 4 : 5;
      this.tempVideoItem = _.Util.getRandomCarItem(o);
    }

    for (var i = 0; i < c["default"].arrOwnBody.length; i++) {
      this.isOwnUidEquipBody(c["default"].arrOwnBody[i].uid) || e.push(c["default"].arrOwnBody[i]);
    }

    for (i = 0; i < c["default"].arrOwnWheel.length; i++) {
      this.isOwnUidEquipWheel(c["default"].arrOwnWheel[i].uid) || e.push(c["default"].arrOwnWheel[i]);
    }

    for (i = 0; i < c["default"].arrOwnWeapon.length; i++) {
      this.isOwnUidEquipWeapon(c["default"].arrOwnWeapon[i].uid) || e.push(c["default"].arrOwnWeapon[i]);
    }

    for (i = 0; i < c["default"].arrOwnTools.length; i++) {
      this.isOwnUidEquipUseTools(c["default"].arrOwnTools[i].uid) || e.push(c["default"].arrOwnTools[i]);
    }

    return e = this.sortItemData(!0, e), this.arrAssemblyData = e, this.tempVideoItem && null != this.tempVideoItem.video && this.tempVideoItem.video && (e.unshift(this.tempVideoItem), _.Util.saveTempOwnCarData(!0, this.tempVideoItem, this.tempVideoItem.type)), e;
  }, e.prototype.sortItemData = function (t, e, o) {
    if (t) {
      var i = this.sortItemData(!1, e, s.Basics_Items_Type.body),
          n = this.sortItemData(!1, e, s.Basics_Items_Type.wheel);
      i.push.apply(i, n);
      var a = this.sortItemData(!1, e, s.Basics_Items_Type.weapon);
      i.push.apply(i, a);
      var r = this.sortItemData(!1, e, s.Basics_Items_Type.tools);
      return i.push.apply(i, r), i;
    }

    var l = null;

    switch (o) {
      case s.Basics_Items_Type.body:
        l = s.Basics_Body_Info;
        break;

      case s.Basics_Items_Type.wheel:
        l = s.Basics_Wheel_Info;
        break;

      case s.Basics_Items_Type.weapon:
        l = s.Basics_Weapon_Info;
        break;

      case s.Basics_Items_Type.tools:
        l = s.Basics_Tools_Info;
        break;

      default:
        return;
    }

    return this.sortData(e, l);
  }, e.prototype.sortData = function (t, e) {
    for (var o = [], i = 0; i < t.length; i++) {
      for (var n = t[i].id, a = 0; a < e.length; a++) {
        o[a] || (o[a] = []), n == e[a].id && o[a].push(t[i]);
      }
    }

    var r = [];

    for (i = 0; i < o.length; i++) {
      if (o[i].length > 1 && o[i].sort(function (t, e) {
        return t.type != s.Basics_Items_Type.body || t.quality === e.quality ? e.star == t.star ? _.Util.getOwnItemPower(e) - _.Util.getOwnItemPower(t) : e.star - t.star : e.quality - t.quality;
      }), o[i].length > 0) for (a = 0; a < o[i].length; a++) {
        r.push(o[i][a]);
      }
    }

    for (var l = 0, c = r; l < c.length; l++) {
      var d = c[l];

      if (null != d.video && d.video) {
        var h = d;
        r.splice(r.indexOf(d), 1), r.unshift(h);
      }
    }

    return r;
  }, e.prototype.onShowEquipHint = function (t, e, o) {
    if (!this._equipHint) {
      var i = cc.instantiate(this.pfb_equipHint);
      this.node.addChild(i), this._equipHint = i.getComponent(p["default"]);
    }

    this._equipHint.updateHint(t, e, o);
  }, e.prototype.updateAttributeItem = function (t) {
    this.attributeView.updateView(t);
  }, e.prototype.updateAttributeItemState = function () {
    this.attributeView.updateState();
  }, e.prototype.updateAttributeTotal = function (t) {
    var e = this.attributeTotalView.updateTotal(this._nCarIndex, t);
    t && this.onShowEquipHint(e.elec, e.hp, e.damage);
  }, e.prototype.onTouchStart = function (t) {
    this.posScrollContent = this.scrollContent_Items.position, this._curTouchItem = t;
  }, e.prototype.onTouchEnable = function (t, e, o) {
    if (Math.abs(this.scrollContent_Items.position.x - this.posScrollContent.x) > 50) this._curTouchItem && this._curTouchItem.recoverTouchMove();else {
      this.posScrollContent && (this.scrollContent_Items.position = this.posScrollContent), this.scroll_Items.enabled = !1, this.isTouchEnable = t, this.touchItemIndex = e, this.touchItem || (this.touchItem = cc.instantiate(this.pfb_assemblyItem), this.node.addChild(this.touchItem)), this.touchItem.active = !0, this.arrAssemblyData[e].type == s.Basics_Items_Type.body && this.touchItem.getComponent(u.AssemblyItem).setItembodyState(!0), this.touchItem.getComponent(u.AssemblyItem).updateItem(this, !0, e, this.arrAssemblyData[e], !1, u.Assembly_Type.Assembly);
      var i = this.node.convertToNodeSpaceAR(o);
      this.touchItem.position = cc.v3(i.x, i.y, 0), this.playAudio(l.Audio_ID.item_pick), this.arrAssemblyData[e].type == s.Basics_Items_Type.wheel ? this.onShowCarWheelFrame(!0) : this.arrAssemblyData[e].type == s.Basics_Items_Type.weapon ? this.onShowCarWeaponFrame(!0) : this.arrAssemblyData[e].type == s.Basics_Items_Type.tools ? this.onShowCarToolsFrame(!0) : this.arrAssemblyData[e].type == s.Basics_Items_Type.body && (this.onShowCarWheelFrame(!0), this.onShowCarWeaponFrame(!0), this.onShowCarToolsFrame(!0));
    }
  }, e.prototype.onTouchEnd = function (t) {
    var e = this,
        o = this.node.convertToNodeSpaceAR(t);
    console.log("itemEnterUid:" + this.itemEnterUid + ",getItemUid:" + this.touchItem.getComponent(u.AssemblyItem).getItemUid()), this.scroll_Items.enabled = !0;
    var i = this.justEquip(this.itemExitUid, this.itemEquipIndex);
    if (this.hallControl.onEquipCarItem(this.itemEnterUid, this.itemExitUid, this.itemColliderTag, this.itemEquipIndex), !this.touchItem || !this.touchItem.active) return this.updateScrolView(this.curShowType), void this.resetEquipCarData();
    if (i && this.itemExitUid) return this.touchItem.active = !1, this.touchItem.position = cc.v3(o.x, o.y, 0), this.updateScrolView(this.curShowType), void this.resetEquipCarData();
    var n = this.touchItem.getComponent(u.AssemblyItem).itemData;
    if (n && null != n.video && n.video) return this.playAudio(l.Audio_ID.item_drop), void cc.tween(this.touchItem).to(.5, {
      position: cc.v3(o.x, o.y, 0),
      opacity: 80
    }).call(function () {
      e.touchItem.active = !1, e.touchItem.opacity = 255, e.arrAssemblyItems[e.touchItemIndex].recoverTouchMove();
    }).start();
    console.log("itemEnterUid2:" + this.itemEnterUid + ",getItemUid2:" + this.touchItem.getComponent(u.AssemblyItem).getItemUid()), this.touchItem.getComponent(u.AssemblyItem).getItemUid() == this.itemEnterUid ? (console.log("装配"), this.touchItem.active = !1, this.touchItem.position = cc.v3(o.x, o.y, 0), this.updateScrolView(this.curShowType), this.hallControl.reset_Guide(), this.scheduleOnce(this.onGuideAction, .5)) : (this.playAudio(l.Audio_ID.item_drop), cc.tween(this.touchItem).to(.5, {
      position: cc.v3(o.x, o.y, 0),
      opacity: 80
    }).call(function () {
      e.touchItem.active = !1, e.touchItem.opacity = 255, e.arrAssemblyItems[e.touchItemIndex].recoverTouchMove();
    }).start()), this.resetEquipCarData();
  }, e.prototype.onEquipCarItem = function (t, e, o, i) {
    console.log("enterId:" + t + ",exitId:" + e), this.itemEnterUid = t, this.itemExitUid = e, this.itemColliderTag = o, this.itemEquipIndex = i;
  }, e.prototype.resetEquipCarData = function () {
    this.itemEnterUid = 0, this.itemExitUid = 0, this.itemColliderTag = 0, this.itemEquipIndex = 0, this.updateAttributeTotal(!0), this.onShowCarWheelFrame(!1), this.onShowCarWeaponFrame(!1), this.onShowCarToolsFrame(!1);
  }, e.prototype.getTouchState = function () {
    return this.strTouchState;
  }, e.prototype.setTouchState = function (t) {
    this.strTouchState = t;
  }, e.prototype.getTouchMoveUid = function () {
    return this.touchItem.getComponent(u.AssemblyItem).getItemUid();
  }, e.prototype.onTouchStartCallback = function () {}, e.prototype.onTouchMoveCallback = function (t) {
    if (this.isTouchEnable) {
      var e = t.getTouches()[0].getLocation(),
          o = this.node.convertToNodeSpaceAR(e);
      this.touchItem.position = o;
    }
  }, e.prototype.onTouchEndCallback = function () {}, e.prototype.onBtnGetItems = function () {
    this.playAudio(l.Audio_ID.btn_click), m["default"].show("暂未开放，敬请期待！");
  }, e.prototype.onBtnSell = function () {
    if (this.playAudio(l.Audio_ID.btn_click), !this._sellView) {
      var t = cc.instantiate(this.pfb_sell);
      this.hallControl.node.addChild(t), this._sellView = t.getComponent(f["default"]), this._sellView.init(this.hallControl);
    }

    this._sellView.updateView(this.curShowType, this.getAssemblyData(this.curShowType));
  }, e.prototype.setTouchAssembly = function (t, e) {
    var o = cc.find("Canvas").getChildByName("car").getComponent(d["default"]).getCurAssemblyItem(t);
    o && o.onTouchStartCallback(e);
  }, e.prototype.onBtnShowBody = function () {
    this.playAudio(l.Audio_ID.btn_click), this.showBtnIcon(s.Basics_Items_Type.body), this.curShowType == s.Basics_Items_Type.body ? (this.setTouchAssembly(s.Basics_Items_Type.body, !1), this.updateScrolView()) : (this.setTouchAssembly(s.Basics_Items_Type.body, !0), this.updateScrolView(s.Basics_Items_Type.body));
  }, e.prototype.onBtnShowWheel = function () {
    this.playAudio(l.Audio_ID.btn_click), this.showBtnIcon(s.Basics_Items_Type.wheel), this.curShowType == s.Basics_Items_Type.wheel ? (this.setTouchAssembly(s.Basics_Items_Type.wheel, !1), this.updateScrolView()) : (this.setTouchAssembly(s.Basics_Items_Type.wheel, !0), this.updateScrolView(s.Basics_Items_Type.wheel));
  }, e.prototype.onBtnShowWeapon = function () {
    this.playAudio(l.Audio_ID.btn_click), this.isGuide && this.onGuideUpgrade(), this.showBtnIcon(s.Basics_Items_Type.weapon), this.curShowType == s.Basics_Items_Type.weapon ? (this.setTouchAssembly(s.Basics_Items_Type.weapon, !1), this.updateScrolView()) : (this.setTouchAssembly(s.Basics_Items_Type.weapon, !0), this.updateScrolView(s.Basics_Items_Type.weapon));
  }, e.prototype.onBtnShowTools = function () {
    this.playAudio(l.Audio_ID.btn_click), this.showBtnIcon(s.Basics_Items_Type.tools), this.curShowType == s.Basics_Items_Type.tools ? (this.setTouchAssembly(s.Basics_Items_Type.tools, !1), this.updateScrolView()) : (this.setTouchAssembly(s.Basics_Items_Type.tools, !0), this.updateScrolView(s.Basics_Items_Type.tools));
  }, e.prototype.showBtnIcon = function (t) {
    this.icon_btnBody.active = t == s.Basics_Items_Type.body && !this.icon_btnBody.active, this.icon_btnWeapon.active = t == s.Basics_Items_Type.weapon && !this.icon_btnWeapon.active, this.icon_btnWheel.active = t == s.Basics_Items_Type.wheel && !this.icon_btnWheel.active, this.icon_btnTools.active = t == s.Basics_Items_Type.tools && !this.icon_btnTools.active;
  }, e.prototype.isOwnUidEquipBody = function (t) {
    for (var e = 0; e < c["default"].curEquipBody.length; e++) {
      if (t == c["default"].curEquipBody[e]) return !0;
    }

    return !1;
  }, e.prototype.isOwnUidEquipWheel = function (t) {
    for (var e = 0; e < c["default"].curEquipWheel.length; e++) {
      for (var o = 0; o < c["default"].curEquipWheel[e].length; o++) {
        if (t == c["default"].curEquipWheel[e][o]) return !0;
      }
    }

    return !1;
  }, e.prototype.isOwnUidEquipWeapon = function (t) {
    for (var e = 0; e < c["default"].curEquipWeapon.length; e++) {
      for (var o = 0; o < c["default"].curEquipWeapon[e].length; o++) {
        if (t == c["default"].curEquipWeapon[e][o]) return !0;
      }
    }

    return !1;
  }, e.prototype.isOwnUidEquipUseTools = function (t) {
    for (var e = 0; e < c["default"].curEquipTools.length; e++) {
      for (var o = 0; o < c["default"].curEquipTools[e].length; o++) {
        if (t == c["default"].curEquipTools[e][o]) return !0;
      }
    }

    return !1;
  }, e.prototype.justEquip = function (t, e) {
    if (c["default"].curEquipBody[this._nCarIndex] == t) return !0;

    for (var o = 0; o < c["default"].curEquipWeapon.length; o++) {
      if (c["default"].curEquipWeapon[this._nCarIndex][o] == t) return !0;
    }

    if (e && c["default"].curEquipWheel[this._nCarIndex][e]) return this.itemExitUid = c["default"].curEquipWheel[this._nCarIndex][e], !0;

    for (o = 0; o < c["default"].curEquipTools[this._nCarIndex].length; o++) {
      if (c["default"].curEquipTools[this._nCarIndex][o] == t) return !0;
    }

    return !1;
  }, e.prototype.onShowCarWheelFrame = function (t) {
    this.hallControl.node_car.getComponent(d["default"]).showCarWheelFrame(t);
  }, e.prototype.onShowCarWeaponFrame = function (t) {
    this.hallControl.node_car.getComponent(d["default"]).showCarWeaponFrame(t);
  }, e.prototype.onShowCarToolsFrame = function (t) {
    this.hallControl.node_car.getComponent(d["default"]).showCarToolsFrame(t);
  }, e.prototype.onShowNextCar = function (t) {
    this._nCarIndex = t, this.updateAttributeTotal();
  }, e.prototype.onShowAssembly = function (t) {
    var e = this;
    this._nCarIndex = t, this.node.active = !0, cc.tween(this.frame_attribute).to(.3, {
      position: cc.v3(this.posFrame_Attibute.x, this.posFrame_Attibute.y, 0)
    }, {
      easing: "bounceOut"
    }).call(function () {
      e.frame_attribute.getComponent(cc.Widget).enabled = !0;
    }).start(), this.updateAttributeTotal(), cc.tween(this.frame_attributeNum).to(.3, {
      position: cc.v3(this.posFrame_AttibuteNum.x, this.posFrame_AttibuteNum.y, 0)
    }, {
      easing: "bounceOut"
    }).call(function () {
      e.frame_attributeNum.getComponent(cc.Widget).enabled = !0;
    }).start(), cc.tween(this.frame_btnCarType).to(.3, {
      position: cc.v3(this.posframe_btnCarType.x, this.posframe_btnCarType.y, 0)
    }, {
      easing: "bounceOut"
    }).call(function () {
      e.frame_btnCarType.getComponent(cc.Widget).enabled = !0;
    }).start(), cc.tween(this.frame_scrollview).to(.3, {
      position: cc.v3(this.posFrame_ScrollView.x, this.posFrame_ScrollView.y, 0)
    }, {
      easing: "bounceOut"
    }).call(function () {
      e.frame_btnBack.active = !0, e.scheduleOnce(function () {
        4 != c["default"].nTotalGame || c["default"].upgradeState || e.onGuideUpgrade();
      }, .5), e.scheduleOnce(e.onGuideAction, .8), null != c["default"].superCarPanel && c["default"].superCarPanel.destroy();
    }).start();
  }, e.prototype.onGuideUpgrade = function (t) {
    var e = this;

    switch (this.guideIndex) {
      case 0:
        this.scheduleOnce(function () {
          e.hallControl.guide_click(e.node_weapon, -1), e.isGuide = !0;
        }, .5);
        break;

      case 1:
        this.isGuide && this.hallControl.guide_click(this.node_upgrade, -1);
        break;

      case 2:
        this.isGuide && (this.hallControl.guide_click(t, -1), this.isGuide = !1);
    }

    this.guideIndex++;
  }, e.prototype.getItemNode = function (t) {
    for (var e = 0; e < this.arrAssemblyItems.length; e++) {
      var o = this.arrAssemblyItems[e];
      if (t == o.itemData.id && 1 == o.itemData.star) return o.node;
    }

    return null;
  }, e.prototype.onShowHall = function (t) {
    var e = this,
        o = .3;
    t && (this.node.active = !1, o = 0), this.frame_btnBack.active = !1, this.frame_attribute.getComponent(cc.Widget).enabled = !1, cc.tween(this.frame_attribute).to(o, {
      position: cc.v3(this.posFrame_Attibute.x - cc.winSize.width / 2, this.posFrame_Attibute.y, 0)
    }, {
      easing: "smooth"
    }).start(), this.frame_attributeNum.getComponent(cc.Widget).enabled = !1, cc.tween(this.frame_attributeNum).to(o, {
      position: cc.v3(this.posFrame_AttibuteNum.x, this.posFrame_AttibuteNum.y - cc.winSize.height / 2, 0)
    }, {
      easing: "smooth"
    }).start(), this.frame_btnCarType.getComponent(cc.Widget).enabled = !1, cc.tween(this.frame_btnCarType).to(o, {
      position: cc.v3(this.posframe_btnCarType.x + cc.winSize.width / 2, this.posframe_btnCarType.y, 0)
    }, {
      easing: "smooth"
    }).start(), this.frame_btnCarType.getComponent(cc.Widget).enabled = !1, cc.tween(this.frame_scrollview).to(o, {
      position: cc.v3(this.posFrame_ScrollView.x, this.posFrame_ScrollView.y + cc.winSize.height / 2, 0)
    }, {
      easing: "smooth"
    }).call(function () {
      e.node.active = !1;
    }).start();
  }, e.prototype.playAudio = function (t) {
    this.hallControl.playAudio(t);
  }, e.prototype.onLightActivie = function (t) {
    if (t) ;else {
      this.hallControl.node_car.getComponent(d["default"]).onLightActivie(!1);

      for (var e = 0; e < this.arrAssemblyItems.length; e++) {
        this.arrAssemblyItems[e] && this.arrAssemblyItems[e].onLightActivie(!1);
      }
    }
  }, e.prototype.onBackHall = function () {
    _.Util.is_VIVO() && !c["default"].bAuditMode && _.Util.showNativeGridAd(), 1 == c["default"].nTotalGame && v["default"].getIns().logEvent(v.LogEventType.Car2refitBack, "", 2), this.frame_scrollview.stopAllActions(), this.hallControl.reset_Guide(), this.onGuideAction(), this.showBtnIcon(""), this.curShowType = null, this.hallControl.onBtnBackHall(), this.tempVideoItem && null != this.tempVideoItem.video && this.tempVideoItem.video && _.Util.saveTempOwnCarData(!1, this.tempVideoItem, this.tempVideoItem.type), this.tempVideoItem = null;
  }, a([w(r["default"])], e.prototype, "attributeView", void 0), a([w(h["default"])], e.prototype, "attributeTotalView", void 0), a([w(cc.Prefab)], e.prototype, "pfb_sell", void 0), a([w(cc.ScrollView)], e.prototype, "scroll_Items", void 0), a([w(cc.Node)], e.prototype, "scrollContent_Items", void 0), a([w(cc.Prefab)], e.prototype, "pfb_assemblyItem", void 0), a([w(cc.Prefab)], e.prototype, "pfb_equipHint", void 0), a([w(cc.Node)], e.prototype, "frame_attribute", void 0), a([w(cc.Node)], e.prototype, "frame_attributeNum", void 0), a([w(cc.Node)], e.prototype, "frame_scrollview", void 0), a([w(cc.Node)], e.prototype, "frame_btnCarType", void 0), a([w(cc.Node)], e.prototype, "frame_btnBack", void 0), a([w(cc.Node)], e.prototype, "icon_btnBody", void 0), a([w(cc.Node)], e.prototype, "icon_btnWheel", void 0), a([w(cc.Node)], e.prototype, "icon_btnWeapon", void 0), a([w(cc.Node)], e.prototype, "icon_btnTools", void 0), a([w(y["default"])], e.prototype, "scrollViewOptimize", void 0), a([w(cc.Node)], e.prototype, "node_weapon", void 0), a([w(cc.Node)], e.prototype, "node_upgrade", void 0), a([b], e);
}(cc.Component);

o["default"] = S;

cc._RF.pop();